<?php

declare(strict_types=1);
/*
 * This file is part of eelly package.
 *
 * (c) eelly.com
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Eelly\SDK\Activity\Api;

use Eelly\SDK\EellyClient;
use Eelly\SDK\Activity\Service\CouponInterface;
use Eelly\SDK\Activity\DTO\CouponDTO;

/**
 *
 * @author shadonTools<localhost.shell@gmail.com>
 */
class Coupon
{
    /**
     * 根据优惠券id获取优惠券信息
     *
     * @param array $couponIds 优惠券ids
     *
     * @return array
     * @author wechan
     * @since 2020年4月08日
     */
    public function getCouponByCouponIds(array $couponIds):array
    {
        return EellyClient::requestJson('activity/coupon', __FUNCTION__, ['couponIds' => $couponIds]);
    }

    public static function adminCouponPage(array $condition, int $page = 1, int $limit = 30): array
    {
        return EellyClient::requestJson('activity/coupon', __FUNCTION__, [
            'condition' => $condition,
            'page' => $page,
            'limit' => $limit,
        ]);
    }

    /**
     * @return self
     */
    public static function getInstance(): self
    {
        static $instance;
        if (null === $instance) {
            $instance = new self();
        }

        return $instance;
    }
}
